﻿namespace Common.Contracts
{
  using System;
  using System.Configuration;
  using System.IO;
  using System.Web;

  public class ServiceConfig : IServiceConfig
  {
    public bool IsFakeService()
    {
      return (!String.IsNullOrEmpty(ServiceMode) && ServiceMode.ToLower() == "fake");
    }

    public string ServiceMode
    {
      get
      {
        return (ConfigurationManager.AppSettings["ServiceMode"] ?? string.Empty);
      }
    }

    public string FakeDataFolder
    {
      get
      {
        return Path.Combine(
          HttpContext.Current.Server.MapPath("~/App_Data"),
          ConfigurationManager.AppSettings["ServiceFakeDataFolder"]);
      }
    }

    public string SearchByGridIdDataFilePath
    {
      get
      {
        return Path.Combine(this.FakeDataFolder, "SearchByGridId.xml");
      }
    }

    public string SearchByParamsDataFilePath
    {
      get
      {
        return Path.Combine(this.FakeDataFolder, "SearchByParams.xml");
      }
    }

    public string SamplePdfFilePath
    {
      get
      {
        return Path.Combine(this.FakeDataFolder, "SamplePdf.pdf");
      }
    }

  }
}
